package com.youi.util;

import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


/**
 * 日志工具类
 * @author  erdong.Chan
 *
 */
public class LogUtil {
	
	private static Logger logger = LogManager.getLogger(LogUtil.class);
	
	public static String textUrl=null;
	
	public static void  Debug(String message){
		logger.debug(message);
	}
	
	public static void  Info(String message){
		logger.info(message);
	}
	
	public static void  Error(String message){
		logger.error(message);
	}
	
	public static void  Warn(String message){
		logger.warn(message);
	}
	
	/**
	 * 获取所有参数
	 * @param request
	 */
	public static void LogAllAttribute(HttpServletRequest request,String url){
		Enumeration enu=request.getParameterNames();  
		while(enu.hasMoreElements()){  
			String paraName=(String)enu.nextElement();
			System.out.println(paraName+"="+request.getParameter(paraName));
			LogUtil.Info(paraName+": "+request.getParameter(paraName));
		}
	}
}
